package test;

/**
 * @author oldliu
 * @since 1.0
 */
public class Zuichagnfu2 {
    public static void main(String[] args) {
        String str="abckcba";
        for (int i =str.length()/2 ;i>=1; i--) {
            System.out.println("取"+i+"个");
            for (int j = 0; j < str.length()-i; j++) {
                //从j这个位置，取i个字符
                String s1=str.substring(j,i+j);//!!!!!!
                //剩下的叫放入s2
                String s2=str.substring(i+j);
                if(s2.contains(s1)){
                    System.out.println(s1);
                    return;
                }

            }
        }
        System.out.println("没有");
    }
}
